/**
 *
 */
package com.ssyt.examinationsystem.entity;

import java.io.Serializable;
import java.util.List;

/**
 * 分页类
 *
 * @author Administrator
 */
public class PageBean implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private Integer totalRecords; // 总记录数
    private Integer totalPages; // 总页数
    private Integer pageSize = 10; // 每页显示数
    private Integer currentPage = 1; // 当前页
    private List<?> list; // 每页显示的记录集合

    //////////////// 构造函数区///////////////////
    public PageBean() {

    }

    public PageBean(Integer totalRecords, Integer pageSize, Integer currentPage) {
        this.totalRecords = totalRecords;
        this.pageSize = pageSize;
        this.currentPage = currentPage;
        if (totalRecords != null) {
            // 计算总页数
            this.totalPages = (int) Math.ceil(totalRecords / (double) pageSize);
        }
    }

    public Integer getTotalRecords() {
        return totalRecords;
    }

    public void setTotalRecords(Integer totalRecords) {
        this.totalRecords = totalRecords;
    }

    public Integer getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(Integer totalPages) {
        this.totalPages = totalPages;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public List<?> getList() {
        return list;
    }

    public void setList(List<?> list) {
        this.list = list;
    }
}
